package cn.sgjk.train.business.controller.admin;


import cn.sgjk.train.common.context.LoginMemberContext;
import cn.sgjk.train.common.resp.CommonResp;
import cn.sgjk.train.common.resp.PageResp;
import cn.sgjk.train.business.req.DailyTrainStationQueryReq;
import cn.sgjk.train.business.req.DailyTrainStationSaveReq;
import cn.sgjk.train.business.resp.DailyTrainStationQueryResp;
import cn.sgjk.train.business.service.DailyTrainStationService;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/admin/daily-train-station")
public class DailyTrainStationAdminController {

    private static final Logger LOG = LoggerFactory.getLogger(DailyTrainStationAdminController.class);
    @Autowired
    private DailyTrainStationService dailyTrainStationService;



    @PostMapping("/save")
    public CommonResp<Object> save(@Valid @RequestBody DailyTrainStationSaveReq dailyTrainStationReq) {
        dailyTrainStationService.save(dailyTrainStationReq);
        return new CommonResp<>();
    }



    @GetMapping("/query-list")
    public CommonResp<PageResp<DailyTrainStationQueryResp>> query(@Valid DailyTrainStationQueryReq dailyTrainStationQueryReq) {
        PageResp<DailyTrainStationQueryResp> dailyTrainStationQueryResps = dailyTrainStationService.queryList(dailyTrainStationQueryReq);
        return new CommonResp<>(dailyTrainStationQueryResps);
    }

    @DeleteMapping("/delete/{id}")
    public CommonResp<Object> delete(@PathVariable Long id) {
        dailyTrainStationService.delete(id);
        return new CommonResp<>();
    }
}

